home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / Prograph Classic 2.6.1 / Examples / DragItem / DragItem Read Me < prev    next >
Encoding:
Text File  |  1995-12-05  |  3.9 KB  |  66 lines  |  [TEXT/ttxt]

  1. Example:                        Drag Item
  2. Written by:                    John Garden, Pictorius Incorporated
  3. Updated for 2.6.1 by:            The Tech Support Team, Pictorius Incorporated
  4.  
  5. Contents:     Drag Item.pgs
  6.                    Drag Item.ReadMe
  7.                    CopyPix.XDEF
  8.                    CopyPix XDEF • Read me
  9.  
  10. Needs Prograph Extensions:
  11.                    The default configuration of your 'Prograph Extensions' folder.  Plus the CopyPix.XDEF should be added to your Prograph Extensions folder and all externals rebuilt.
  12.  
  13. Needs Libraries to Compile:
  14.                     SCLibrary 2.6
  15.                     Library 2.6
  16.  
  17. Standard Methods That Were Modified:
  18.                    None
  19.  
  20. Using the Drag Item class
  21. -----------------------
  22. It is a good idea to create and use a sub-class of Drag Item for your draggable objects. Overshadow the methods of Drag Item, rather than editing them ( ie create methods of the same names in your sub-class ).
  23.  
  24. Overshadowing Methods
  25. ---------------------
  26. There are four routines in the Drag Item class that can be overshadowed.  They are used as follows:
  27.  
  28. Update
  29. ------
  30. This method draws the Drag Item, and MUST be overshadowed. You
  31. should put your draw code here. If you use the "location" attribute of the Drag Item in this routine, be sure to use the overriding get method.  Otherwise, your drawing will not be performed correctly.
  32.  
  33. click
  34. -----
  35. This is the method that is called when a click occurs in a Drag Item.  The first thing you should do in your click method is call "//drag". This method will fail if the click is not a drag, allowing you to process non drag clicks.
  36.  
  37. hit?
  38. ----
  39. This method is used to determine if a click is actually within the
  40. bounds of your object. Overshadow it if you do not want the entire rect of the Drag Item to respond to dragging. Your method should succeed or fail accordingly.
  41.  
  42. limit
  43. -----
  44. This method returns the rect within which the Drag Item may be
  45. dragged. The default value is the entire window rect. Overshadow it if you wish to limit dragging to a rect within the window.
  46.  
  47.  
  48. Memory Considerations
  49. ---------------------
  50. Dragging a Drag Item uses two Pixmaps. One is the size of the
  51. window; the other is the size of the Drag Item. In order to be as flexible as possible, the Drag Item class allocates these PixMaps dynamically as they are needed. Thus, each time a drag begins, two PixMaps are allocated and then disposed of when the drag is finished.
  52.  
  53. The advantage of this approach is that changes in the size or depth of the window or the size of the Drag Item require no special consideration.
  54.  
  55. The disadvantage is that, depending on the amount of memory
  56. available and the state it is in, the allocation process this can cause a slight delay before the Drag Item will respond to the drag and follow the mouse.
  57.  
  58. If you wish to avoid this pause, you can modify the code to allocate one or both of the PixMaps at startup, and use them repeatedly. In this case, any changes in the window size or depth, or any change in the size of the object(s) being dragged will necessitate the re-allocation of one or both PixMaps.
  59.  
  60. General Notes
  61. -------------
  62.             Be careful with the "location" attribute. Always use the
  63. overshadowed get and set methods for it. If you explicitly set it in the Application Builder or directly in the instance, be sure to set the "drag loc" attribute to the same value. Otherwise, subsequent drawing of the Drag Item will be incorrect.
  64.  
  65. To avoid flickering of Window Items caused by redrawing after a
  66. drag, both the old and new positions of the Drag Item are validated ( This is done in the "after" local of the drag routine ). The drag routine performs the update explicitly. However, Window Items such as Buttons ( or any other control ) cannot be updated by the drag routine. If you have such items residing within your drag limits, you may wish to modify the code to allow them to be updated. This will cause some flickering, but is necessary to allow such items to be properly redrawn.